package com.dzm.demo.myshop.commons.utils;

import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 邮件发送工具类
 *@author:LeoDang
 *@date:2019/8/6
 *@version 1.0.0
 */
public class EmailsSendUtils {

    @Autowired
    private  Email email;

    public void send(String subject,String msg,String... to) throws EmailException {
        email.setSSLOnConnect(true);
        email.setSubject("TestMail");
        email.setMsg(msg);
        email.addTo(to);
        email.send();
    }
}
